import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const store = new Vuex.Store({
	state: {
		statusBarHeight: 39,
		/* 状态栏高度 */
		navBarHeight: 48,
		/* 导航栏高度 */
		windowWidth: 255,
		userimg:'',
		uname:''
	},
	mutations: {
		tabarDara(state, value) {
			state.statusBarHeight = value.statusBarHeight
			state.navBarHeight = value.navBarHeight
			state.windowWidth = value.windowWidth
		},
		setuser(state,data){
			state.userimg = data.avatarUrl
			state.uname = data.uname
		}
	},
	actions: {
		addasync(context,data){
			context.commit('tabarDara',data)
		},
		cheangUser(context,data){
			context.commit('setuser',data)
		}
	},
	getters:{
		statusBarHeight(state){
			return state.statusBarHeight
		},
		navBarHeight(state){
			return state.navBarHeight
		},
		windowWidth(state){
			return state.windowWidth
		},
		userimg(state){
			return state.userimg
		},
		uname(state){
			return state.uname
		}
	}
})
export default store
